
package ro.imc.rest.client;

import ro.imc.rest.client.display.LoginBoxForm;
import ro.imc.rest.client.display.util.DialogForm;
import ro.imc.rest.client.display.util.MessageConstants;
import ro.imc.rest.client.display.util.RootPanelDivId;
import ro.imc.rest.client.display.util.RootPanelManager;
import ro.imc.rest.client.services.forserver.BasicService;
import ro.imc.rest.client.services.forserver.BasicServiceAsync;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class ClixRestSearchGWT implements EntryPoint {

	private static BasicServiceAsync service = GWT.create(BasicService.class);
	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		service.startServerPrecondition(new AsyncCallback<Void>() {
			@Override
			public void onSuccess(Void result) {
				RootPanelManager.attachForm(RootPanelDivId.LOGIN_FORM_ID, new LoginBoxForm());
			}
			
			@Override
			public void onFailure(Throwable caught) {
				DialogForm.displayDialog(MessageConstants.CONF_ERR_TITLE,
										MessageConstants.CONF_ERR_HTML,
										MessageConstants.CONF_ERR_MESSAGE,
										MessageConstants.CONF_ERR_TIP);
			}
		});
	}
}
